package test;


import java.nio.ByteBuffer;
import java.util.Scanner;
/**
 * <P>Author ideaAdmin
 * <P>TODO:  使用nio获得内存 NIO(new IO/Non-Blocking IO)非阻塞的IO流 使用Channel(通道)
 * <P>Date 11:13 2022/2/26

 **/
public class NioGetMemory {
    public static final int CAPACITY = 1024 * 1024 * 1024;//1G

    public static void main(String[] args) {
		ByteBuffer byteBuffer = ByteBuffer.allocateDirect(CAPACITY);

		System.out.println("获取内存完毕");
		Scanner scanner = new Scanner(System.in);
		scanner.next();


		byteBuffer = null;
		System.gc();
		System.out.println("释放完毕");
		scanner.next();
	}
}


